
import ControllerState from '../ControllerState';

export default async function updateRendererSize(s: ControllerState) {
    if (!s.renderer || !s.cont || !s.camera) return;
    s.cont.innerHTML = "";
    s.renderer.setSize(s.cont.offsetWidth, s.cont.offsetHeight);
    s.camera.aspect = s.cont.offsetWidth / s.cont.offsetHeight;
    s.camera.updateProjectionMatrix();
    s.cont.appendChild(s.renderer.domElement);
}